import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '接收短信的手机号',
    align:"center",
    dataIndex: 'phoneNumber'
   },
   {
    title: '阿里云短信模板 ID',
    align:"center",
    dataIndex: 'templateCode'
   },
   {
    title: '短信签名',
    align:"center",
    dataIndex: 'signName'
   },
   {
    title: '短信模板参数（JSON 格式）',
    align:"center",
    dataIndex: 'templateParam'
   },
   {
    title: '短信内容',
    align:"center",
    dataIndex: 'content'
   },
   {
    title: '阿里云返回的 bizId',
    align:"center",
    dataIndex: 'bizId'
   },
   {
    title: '发送状态：0-待发送，1-发送成功，2-发送失败',
    align:"center",
    dataIndex: 'sendStatus'
   },
   {
    title: '发送时间',
    align:"center",
    dataIndex: 'sendTime'
   },
   {
    title: '阿里云返回的状态码',
    align:"center",
    dataIndex: 'responseCode'
   },
   {
    title: '阿里云返回的状态描述',
    align:"center",
    dataIndex: 'responseMsg'
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'remark'
   },
   {
    title: '记录创建时间',
    align:"center",
    dataIndex: 'createdAt'
   },
   {
    title: '记录更新时间',
    align:"center",
    dataIndex: 'updatedAt'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '接收短信的手机号',
    field: 'phoneNumber',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入接收短信的手机号!'},
          ];
     },
  },
  {
    label: '阿里云短信模板 ID',
    field: 'templateCode',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入阿里云短信模板 ID!'},
          ];
     },
  },
  {
    label: '短信签名',
    field: 'signName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入短信签名!'},
          ];
     },
  },
  {
    label: '短信模板参数（JSON 格式）',
    field: 'templateParam',
    component: 'InputTextArea',
  },
  {
    label: '短信内容',
    field: 'content',
    component: 'InputTextArea',
  },
  {
    label: '阿里云返回的 bizId',
    field: 'bizId',
    component: 'Input',
  },
  {
    label: '发送状态：0-待发送，1-发送成功，2-发送失败',
    field: 'sendStatus',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入发送状态：0-待发送，1-发送成功，2-发送失败!'},
          ];
     },
  },
  {
    label: '发送时间',
    field: 'sendTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入发送时间!'},
          ];
     },
  },
  {
    label: '阿里云返回的状态码',
    field: 'responseCode',
    component: 'Input',
  },
  {
    label: '阿里云返回的状态描述',
    field: 'responseMsg',
    component: 'Input',
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
  {
    label: '记录创建时间',
    field: 'createdAt',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入记录创建时间!'},
          ];
     },
  },
  {
    label: '记录更新时间',
    field: 'updatedAt',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入记录更新时间!'},
          ];
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  phoneNumber: {title: '接收短信的手机号',order: 0,view: 'text', type: 'string',},
  templateCode: {title: '阿里云短信模板 ID',order: 1,view: 'text', type: 'string',},
  signName: {title: '短信签名',order: 2,view: 'text', type: 'string',},
  templateParam: {title: '短信模板参数（JSON 格式）',order: 3,view: 'textarea', type: 'string',},
  content: {title: '短信内容',order: 4,view: 'textarea', type: 'string',},
  bizId: {title: '阿里云返回的 bizId',order: 5,view: 'text', type: 'string',},
  sendStatus: {title: '发送状态：0-待发送，1-发送成功，2-发送失败',order: 6,view: 'number', type: 'number',},
  sendTime: {title: '发送时间',order: 7,view: 'datetime', type: 'string',},
  responseCode: {title: '阿里云返回的状态码',order: 8,view: 'text', type: 'string',},
  responseMsg: {title: '阿里云返回的状态描述',order: 9,view: 'text', type: 'string',},
  remark: {title: '备注',order: 10,view: 'text', type: 'string',},
  createdAt: {title: '记录创建时间',order: 11,view: 'datetime', type: 'string',},
  updatedAt: {title: '记录更新时间',order: 12,view: 'datetime', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}